package entity

import "github.com/lib/pq"

type Ebike struct {
	ID int64 `gorm:"column:id;type:BIGINT;primary_key" json:"id"`

	TypeID int64 `gorm:"column:type_id;type:BIGINT" json:"type_id"`

	Name string `gorm:"column:name;type:VARCHAR(255)" json:"name"`

	Photo string `json:"photo"`

	Status int `gorm:"column:status;type:TINYINT" json:"status"`

	FrameCode string `gorm:"column:frame_code;type:VARCHAR(255)" json:"frame_code"`

	EngineCode string `gorm:"column:engine_code;type:VARCHAR(255)" json:"engine_code"`

	Color string `gorm:"column:color;type:VARCHAR(255)" json:"color"`

	IsBind int `gorm:"column:is_bind;type:TINYINT" json:"is_bind"`

	Stock int `gorm:"column:stock;type:TINYINT" json:"stock"`

	AESKey string `gorm:"column:aes_key;type:VARCHAR(255)" json:"aes_key"`

	IV string `gorm:"column:iv;type:VARCHAR(255)" json:"iv"`

	StoreID   int64 `gorm:"column:store_id;type:BIGINT" json:"store_id"`
	ControlId int64 `gorm:"column:control_id;type:BIGINT" json:"control_id"`
	BatteryId int64 `gorm:"column:battery_id;type:BIGINT" json:"battery_id"`

	BindUsers pq.StringArray `gorm:"column:bind_users;type:VARCHAR" json:"bind_users"`

	CreatedAt int64 `gorm:"column:created_at;type:BIGINT" json:"created_at"`

	UpdatedAt int64 `gorm:"column:updated_at;type:BIGINT" json:"updated_at"`

	SNCode string `gorm:"column:sn_code;type:VARCHAR(255)" json:"sn_code"`

	SaleTime int64 `json:"sale_time"`

	ActivationTime int64 `json:"activation_time"`

	DistributeTime int64 `json:"distribute_time"`
	// 发货时间
	DeliveryTime string `json:"delivery_time"`
	// 易车SNcode
	ErpSNCode string `json:"erp_sn_code"`
	// 发货工厂
	Factory string `json:"factory"`
}

func (a *Ebike) TableName() string {
	return "ebikes"
}
